<template>
        <div class="newsinfo-con">
            <p class="title">{{newsinfo.title}}</p>
            <div class="subtitle">
                <span>发布时间：{{newsinfo.add_time|dateFormat}}</span>
                <span>点击: {{newsinfo.click}}次</span>
                </div>  
               
                <div class="content" v-html="newsinfo.content">
                    
                </div>    
                <!-- 评论内容 -->
                <com-pon :id="this.id"></com-pon>
        </div>
</template>
<script>
import Comment from '../sub/Comment.vue'
import {Toast} from 'mint-ui'
export default {
    data () {
        return {
            id: this.$route.params.id,
            newsinfo: {}
        }
    },
    created(){
        this.getNewsinfo()
    },
    methods:{
        getNewsinfo(){
            this.$axios.get("api/getnew/"+this.id).then(res=>{
                if(res.data.status===0){
                    this.newsinfo=res.data.message[0];
                    Toast('获取新闻数据成功')
                    console.log("aa"+this.newsinfo)
                }else{
                    Toast('获取新闻数据失败')
                }
            })
        }
    },
    components:{
        'com-pon':Comment 
    }
}
</script>
<style lang="scss" scoped>
.newsinfo-con{
    margin-bottom: 50px;
    padding: 5px;
    .title{
        color: red;
        font-size: 15px;
        text-align: center;
    }
  
    .subtitle{
        font-size: 12px;
        color: #555;
        display: flex;
        justify-content: space-between;

        border-bottom: 1px solid #666;
        padding: 0px 10px 1px;
        box-sizing: border-box;
    }
    .content{
        margin-top: 10px;
        padding: 0px 10px;
        box-sizing: border-box;
        img{
            width: 100%;
            height: 100%;
        }
    }
}
</style>
